package com.swsc.ai.controller;

import com.swsc.ai.common.Result;
import com.swsc.ai.entity.request.FtpReqParam;
import com.swsc.ai.service.FtpDownloadFileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @describe: ftp文件下载
 * @author: 容若
 * @created: 2024-06-20 10:11
 */
@Tag(name = "FtpFileDownloadController", description = "ftp文件下载接口")
@Slf4j
@RestController
@RequestMapping("/ftp")
public class FtpFileDownloadController {

    @Autowired
    private FtpDownloadFileService ftpDownloadFileService;

    @PostMapping("/start/download-file")
    @Operation(summary = "ftp文件下载", description = "ftp下载请求")
    public Result<String> downloadFtpFile(@RequestBody FtpReqParam reqParam) {
        log.info("ftp下载请求：{}", reqParam.getReqToken());
        return Result.result(() -> ftpDownloadFileService.downloadFtpFile(reqParam));
    }
}
